import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)


const store = new Vuex.Store({
	state: {
		userInfo: null,
	},
	mutations: {
		login(state, provider) {
			state.userInfo = provider
			uni.setStorageSync('userInfo', provider)
		},
		logout(state) {
			state.userInfo = null
			uni.removeStorageSync('userInfo')
		}
	},
	actions: {},
	setters: {
		setUserInfo(state, provider) {
			state.userInfo = provider;
		}
	},
	getters: {
		getUserInfo(state) {
			return state.userInfo
		}
	}
})

export default store
